/**
 * 列表工具
 * @type {{}}
 */


export const listFor = {
  data() {
    return {
      loading: false,
      toggleSearchStatus:false,
      selectedRowKeys: [],
      pageData:[],
      pageFilter: {
        pageNo: 1,
        pageSize: 10
      },
    };
  },
  methods:{
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
    },
    onTableChange(pagination, pageFilter, sorter) {
      let keyMap = { currentPage: 'pageNo' }
      let paginations = Object.keys(pagination).reduce((newData, key) => {
        let newKey = keyMap[key] || key
        newData[newKey] = pagination[key]
        return newData
      }, {})
      this.pageFilter = Object.assign({}, this.pageFilter, paginations)
      this.refreshTable()
    },
    onSelectedRow(keys) {
      this.selectKeys = keys
      this.isDisabled = keys.length <= 0
    },
  }
}

/**
 * 表单工具
 */
export const listForm = {
  data(){
    return {
      queryParam:{}
    }
  },
  methods:{
    onResetForm() {
      this.form = {}
      this.pageFilter.pageNo = 1
      this.pageFilter.pageSize = 10
      this.refreshTable()
      this.$refs.ruleForm.ruleForm()
    },
    renovate(){
      this.refreshTable()
    },
    reload() {
      this.reloading = true
      this.$nextTick(() => (this.reloading = false))
    },
  }
}

/**
 * 字典工具
 * this.$filterDictTextByCache('nation', text)}
 */


/**
 * 表单操作集成
 */